import { isReallyNull } from '@/common/util'

class User {
  static Update (userInfo) {
    var cacheUser = uni.getStorageSync('USER_INFO')
    cacheUser = Object.assign(cacheUser, userInfo)
    uni.setStorageSync('USER_INFO', cacheUser)
  }

  static Set (userInfo) {
    uni.setStorageSync('USER_INFO', userInfo)
  }

  static Get () {
    var cacheUser = uni.getStorageSync('USER_INFO')
    return cacheUser
  }

  static HadPhone () {
    var user = this.Get()
    if (user && !isReallyNull(user.CellPhone) && user.CellPhone.length > 0) {
      return true
    }
    return false
  }
}
class Token {
  static Set (token) {
    uni.setStorageSync('token', token)
  }

  static Get () {
    return uni.getStorageSync('token')
  }
}
export { User, Token }
